package com.bjpowernode.common;

import com.bjpowernode.common.enums.Code;
import com.bjpowernode.db.domain.FinanceAccount;

import java.math.BigDecimal;

public class CommonUtil {

    //返回业务方法的返回值
    public static Code convert(int code){
        Code codeEnum=Code.FAIL;
        switch (code){
            case 0:
                codeEnum=Code.SUCC;
                break;
            case 1:
                codeEnum=Code.PHONE_HAS_REGISTED;
                break;
        }
        return codeEnum;
    }



    //比较BigDecimal

    //小于
    public static boolean lt(BigDecimal n1,BigDecimal n2){
        if (n1==null || n2==null){
            throw new RuntimeException("n1或者n2为null,不能比较");
        }
        return n1.compareTo(n2) == -1;
    }


    //大于
    public static boolean gt(BigDecimal n1,BigDecimal n2){
        if (n1==null || n2==null){
            throw new RuntimeException("n1或者n2为null,不能比较");
        }
        return n1.compareTo(n2) == 1;
    }
}
